package com.ruoyi.common.sms;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/5/30 14:26
 * @Modified By:
 */
@Data
@NoArgsConstructor
public class MsgResult {
    /**
     * 发送状态 成功 失败
     */
    private String status;
    /**
     * 通道返回码
     */
    private  String code;
    /**
     * 失败信息
     */
    private String errMsg;


    private static String SUCCESS = "SUCCESS";
    private static String FAIL = "FAIL";

    public MsgResult(String status, String code, String errMsg) {
        this.status = status;
        this.code = code;
        this.errMsg = errMsg;
    }

    public static MsgResult success(String code, String errMsg){
        return new MsgResult(SUCCESS,code,errMsg);
    }

    public static MsgResult fail(String code, String errMsg){
        return new MsgResult(FAIL,code,errMsg);
    }

    public static MsgResult fail(){
        return new MsgResult(FAIL,null,null);
    }

    public  boolean isSuccess(){
        return SUCCESS.equals(this.status);
    }
}
